]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
magnifier: Simplify some code
authorFlorian Müllner <fmuellner@gnome.org>
Tue, 20 Aug 2019 02:10:46 +0000 (04:10 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Sun, 15 Sep 2019 14:02:45 +0000 (16:02 +0200)
We don't need nested if blocks to set or unset the crosshairs'
clip size.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/731

js/ui/magnifier.js

index 9d3ad6473cd9648e4c4b373bfa27f74e9c61cae2..73522586f3c55ac03834c4e2e574833d5ae175d7 100644 (file)
@@ -451,15 +451,11 @@ var Magnifier = class Magnifier {
      * @clip:   Flag to indicate whether to clip the crosshairs.
      */
     setCrosshairsClip(clip) {
-        if (clip) {
-            if (this._crossHairs)
-                this._crossHairs.setClip(CROSSHAIRS_CLIP_SIZE);
-        } else {
-            // Setting no clipping on crosshairs means a zero sized clip
-            // rectangle.
-            if (this._crossHairs)
-                this._crossHairs.setClip([0, 0]);
-        }
+        if (!this._crossHairs)
+            return;
+
+        // Setting no clipping on crosshairs means a zero sized clip rectangle.
+        this._crossHairs.setClip(clip ? CROSSHAIRS_CLIP_SIZE : [0, 0]);
     }
 
     /**